﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using HZ.Supervise.Model;

namespace HZ.Supervise.BLL
{
    public class BLL_SpecialAuthority : IBLL.IBLL_SpecialAuthority
    {
        /// <summary>
        /// 按条件查询医院采购权限
        /// </summary>
        /// <param name="where"></param>
        /// <param name="currentpage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalrecord"></param>
        /// <returns></returns>
        public DataTable findHopitalAreaSortSourceByWhere(string where, int currentpage, int pagesize, out int totalrecord)
        {
            return DAL.DAL_SpecialAuthority.findHopitalAreaSortSourceByWhere(where, currentpage, pagesize, out totalrecord);
        }
          /// <summary>
        /// 启用该医院的所有的药品
        /// </summary>
        /// <param name="hospitalId"></param>
        /// <returns></returns>
        public int DeleteAllHospitalGoods(string hospitalId, int SortSource) 
        {
            return DAL.DAL_SpecialAuthority.DeleteAllHospitalGoods(hospitalId,SortSource);
        }
         /// <summary>
        /// 查询所有日志信息
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        public DataTable findAllHospitalGoodsDisableLog(string where) 
        {
            return DAL.DAL_SpecialAuthority.findAllHospitalGoodsDisableLog(where);
        }
         /// <summary>
        /// 插入日志
        /// </summary>
        /// <param name="hospitalGoodsDisableLog"></param>
        /// <returns></returns>
        public int InsertHospitalGoodsDisableLog(HospitalGoodsDisableLog hospitalGoodsDisableLog) 
        {
            return DAL.DAL_SpecialAuthority.InsertHospitalGoodsDisableLog(hospitalGoodsDisableLog);
        }
           /// <summary>
        /// 查询出所有禁用的药品批号
        /// </summary>
        /// <returns></returns>
        public DataTable findAllHospitalGoodsDisable() 
        {
            return DAL.DAL_SpecialAuthority.findAllHospitalGoodsDisable();
        }
         /// <summary>
        /// 根据医院Id查询日志表
        /// </summary>
        /// <param name="hospitalId"></param>
        /// <returns></returns>
        public DataTable GetAllHospitalLog(string hospitalId) 
        {
            return DAL.DAL_SpecialAuthority.GetAllHospitalLog(hospitalId);
        }
        /// <summary>
        /// 插入日志表
        /// </summary>
        /// <param name="hospitalGoodsLog"></param>
        /// <returns></returns>
        public int InsertHospitalGoodsLog(HospitalGoodsLog hospitalGoodsLog) 
        {
            return DAL.DAL_SpecialAuthority.InsertHospitalGoodsLog(hospitalGoodsLog);
        }
         /// <summary>
        /// 插入HospitalGoods表
        /// </summary>
        /// <param name="hospotalGoodList"></param>
        /// <returns></returns>
        public int InsertHospitalGoods(IList<HospitalGoods> hospotalGoodList) 
        {
            return DAL.DAL_SpecialAuthority.InsertHospitalGoods(hospotalGoodList);
        }
          /// <summary>
        /// 根据批号，流水号删除已禁用的数据
        /// </summary>
        /// <param name="hospitalGoodsDisableList"></param>
        /// <returns></returns>
        public  int DeleteHospitalGoodsDisable(IList<HospitalGoodsDisable> hospitalGoodsDisableList) 
        {
            return DAL.DAL_SpecialAuthority.DeleteHospitalGoodsDisable(hospitalGoodsDisableList);
        }
         /// <summary>
        /// 新增药品批号禁用
        /// </summary>
        /// <param name="hospitalGoodsDisableList"></param>
        /// <returns></returns>
        public int InsertHospitalGoodsDisable(IList<HospitalGoodsDisable> hospitalGoodsDisableList) 
        {
            return DAL.DAL_SpecialAuthority.InsertHospitalGoodsDisable(hospitalGoodsDisableList);
        }
          /// <summary>
        /// 根据hospitalList删除
        /// </summary>
        /// <param name="hospotalGoodList"></param>
        /// <returns></returns>
        public int DeleteHospitalGoods(IList<HospitalGoods> hospotalGoodList) 
        {
            return DAL.DAL_SpecialAuthority.DeleteHospitalGoods(hospotalGoodList);
        }
         /// <summary>
        /// 根据条件查询医院所禁用的药品
        /// </summary>
        /// <param name="HospitalID"></param>
        /// <param name="currentpage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalrecord"></param>
        /// <returns></returns>
        public DataTable findHospitalGoodsByWhere(string where,string hospitalId, int currentpage, int pagesize, out int totalrecord) 
        {
            return DAL.DAL_SpecialAuthority.findHospitalGoodsByWhere(where,hospitalId, currentpage, pagesize, out totalrecord);
        }
        /// <summary>
        /// 查询药品撤废目录
        /// </summary>
        /// <param name="where"></param>
        /// <param name="currentpage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalrecord"></param>
        /// <returns></returns>
        public DataTable findTAreaDeleteProcure(string where, int currentpage, int pagesize, out int totalrecord)
        {
            return DAL.DAL_SpecialAuthority.findTAreaDeleteProcure(where, currentpage, pagesize, out totalrecord);
        }
         /// <summary>
        /// 查询采购目录,关联被禁用的
        /// </summary>
        /// <param name="where"></param>
        /// <param name="currentpage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalrecord"></param>
        /// <returns></returns>
        public DataTable findHospitalGoodsDisable(string where, int currentpage, int pagesize, out int totalrecord) 
        {
            return DAL.DAL_SpecialAuthority.findHospitalGoodsDisable(where,currentpage,pagesize,out totalrecord);
        }
        /// <summary>
        /// 查询采购目录
        /// </summary>
        /// <param name="where"></param>
        /// <param name="currentpage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalrecord"></param>
        /// <returns></returns>
        public DataTable findProcureCatalog(string where, int currentpage, int pagesize, out int totalrecord)
        {
            return DAL.DAL_SpecialAuthority.findProcureCatalog(where, currentpage, pagesize, out totalrecord);
        }
        /// <summary>
        /// 查询调价目录
        /// </summary>
        /// <param name="where"></param>
        /// <param name="currentpage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalrecord"></param>
        /// <returns></returns>
        public DataTable AreaPrice(string where, int currentpage, int pagesize, out int totalrecord)
        {
            return DAL.DAL_SpecialAuthority.AreaPrice(where, currentpage, pagesize, out  totalrecord);
        }

        /// <summary>
        /// 添加药品调价
        /// </summary>
        /// <param name="areaID"></param>
        /// <param name="goodsID"></param>
        /// <param name="Aprice"></param>
        /// <returns></returns>
        public int InsertAreaPrice(string areaID, string goodsID, string Aprice, Boolean type, string Aadduserid)
        {
            return DAL.DAL_SpecialAuthority.InsertAreaPrice(areaID, goodsID, Aprice, type, Aadduserid);
        }
         /// <summary>
        /// 禁用该医院的所有药品
        /// </summary>
        /// <param name="hospitalId"></param>
        /// <returns></returns>
        public int UpdateAllHospitalGoods(HospitalGoods hospitalGoods, int SortSource) 
        {
            return DAL.DAL_SpecialAuthority.UpdateAllHospitalGoods(hospitalGoods, SortSource);
        }
        /// <summary>
        /// 修改药品调价
        /// </summary>
        /// <param name="areaID"></param>
        /// <param name="goodsID"></param>
        /// <param name="Aprice"></param>
        /// <returns></returns>
        public int UpdataAreaPrice(string areaID, string goodsID, string Aprice, Boolean type, string Aadduserid)
        {
            return DAL.DAL_SpecialAuthority.UpdataAreaPrice(areaID, goodsID, Aprice, type, Aadduserid);
        }
        /// <summary>
        /// 添加撤废药品
        /// </summary>
        /// <param name="areaID"></param>
        /// <param name="goodsID"></param>
        /// <param name="Aprice"></param>
        /// <returns></returns>
        public int InsertAreaDeleteProcure(string areaID, string goodsID, Boolean type, string Aadduserid)
        {
            return DAL.DAL_SpecialAuthority.InsertAreaDeleteProcure(areaID, goodsID, type, Aadduserid);
        }

        /// <summary>
        /// 修改医院采购范围
        /// </summary>
        /// <param name="has"></param>
        /// <returns></returns>
        public int UpdateHopitalAreaSortSource(List<HZ.Supervise.Model.View.HopitalAreaSortSource> lishas)
        {
            return DAL.DAL_SpecialAuthority.UpdateHopitalAreaSortSource(lishas);

        }
        ///// <summary>
        ///// 修改医院采购范围
        ///// </summary>
        ///// <param name="has"></param>
        ///// <returns></returns>
        //public int UpdateHopitalAreaSortSource(List<HZ.Supervise.Model.View.HopitalAreaSortSource> lishas)
        //{
        //    return DAL.DAL_SpecialAuthority.UpdateHopitalAreaSortSource(lishas);

        //}

        /// 获取历史修改记录
        /// </summary>
        /// <param name="id1">表主键</param>
        /// <param name="id2">历史： 0 医院采购范围，1地区采购药品 ，2地区采购价格</param>
        /// <returns></returns>
        public List<T> GetHostory<T>(string id1, string id2,string id3,string id4) where T : new()
        {
            return DAL.DAL_SpecialAuthority.GetHostory<T>(id1, id2,id3,id4);
        }

        /// <summary>
        /// 获取流水号在该用户地区下的价格和撤废情况
        /// </summary>
        /// <param name="ProcureCatalogid"></param>
        /// <param name="Areaid"></param>
        /// <returns></returns>
        public DataTable GetProcureCatalogAllstate(string ProcureCatalogid, string Areaid)
        {
            return DAL.DAL_SpecialAuthority.GetProcureCatalogAllstate(ProcureCatalogid, Areaid);

        }

        /// <summary>
        ///更调价和地区控制
        /// </summary>
        /// <param name="sql"></param>
        /// <returns></returns>
        public int UpdateChangeall(string sql)
        {
            return DAL.DAL_SpecialAuthority.UpdateChangeall(sql);
        }

    }
}
